<!--
 * @Author: yaoling 1871883713@qq.com
 * @Date: 2022-10-20 18:11:21
 * @LastEditors: yaoling 1871883713@qq.com
 * @LastEditTime: 2022-12-12 14:31:40
 * @FilePath: \company-world\src\views\userManagement\index.vue
 * @Description: 角色权限
-->
<template>
  <div class="role-permissions">
    <RoleManagement ref="manageRef" @click-row="handleClickRow" @get-role-data="getRoleData"></RoleManagement>
    <RoleUser :roleDatas="roleDatas" @reFresh="reFresh"></RoleUser>
  </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import RoleManagement from './components/RoleManagement.vue'
import RoleUser from './components/RoleUser.vue'
import { IRole } from '@/type/index'
import { Itype } from '@/type'
const roleDatas = ref<IRole>()
const handleClickRow = (item: IRole) => {
  roleDatas.value = item
}
/**
 * @desc: 搜索
 */
const tree = ref()
const searchTreeData = (data: string) => {
  tree.value.getData(data)
}
/**
 * @desc:保存dialog
 */
const manageRef = ref<InstanceType<typeof RoleManagement>>()
const reFresh = () => {
  manageRef.value?.getData()
}

/**
 * @desc:重置
 */
const onRefresh = () => {
  tree.value.onRefresh()
}

/**
 * @desc: 获取选中父级角色
 */
const getRoleData = (data: IRole) => {
  roleDatas.value = data
}
</script>

<style lang="less" scoped>
.role-permissions {
  display: flex;
  overflow: hidden;
  width: 100%;
  height: 100%;
}
</style>
